package com.wyp.design.pattern.structural.adapter;

/**
 * 对象适配器
 * ：将一个类的接口转换成客户期望的另一个接口，使原本接口不兼容的类可以一起工作
 *
 * @author: Oliver
 * @time: 2020/5/13/18:19
 */
public class PowerAdapter implements DC5 {
    private AC220 ac220 = new AC220();

    @Override
    public int outputDC5V() {
        int adapterInput = ac220.outputAC220V();
        //变压器...
        int adapterOutput = adapterInput / 44;

        System.out.println("使用PowerAdapter输入AC:" + adapterInput + "V" + "输出DC:" + adapterOutput + "V");
        return adapterOutput;
    }
}
